-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add region resource volume #778
base: master
Are you sure you want to change the base?
Conversation
acf2078
to
14a2bb0
Compare
MinTimeout: 3 * time.Second, | ||
} | ||
|
||
_, err := stateConf.WaitForStateContext(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should retrieve the last result instead like the following:
res, err := stateConf.WaitForStateContext(ctx)
return res, err
and use res
in create func, so that you can remove lines 76-84.
return | ||
} | ||
|
||
endpoint := "/cloud/project/" + url.PathEscape(data.ServiceName.ValueString()) + "/region/" + url.PathEscape(data.RegionName.ValueString()) + "/volume/" + url.PathEscape(data.VolumeId.ValueString()) + "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint := "/cloud/project/" + url.PathEscape(data.ServiceName.ValueString()) + "/region/" + url.PathEscape(data.RegionName.ValueString()) + "/volume/" + url.PathEscape(data.VolumeId.ValueString()) + "" | |
endpoint := "/cloud/project/" + url.PathEscape(data.ServiceName.ValueString()) + "/region/" + url.PathEscape(data.RegionName.ValueString()) + "/volume/" + url.PathEscape(data.VolumeId.ValueString()) |
} | ||
|
||
// Update resource | ||
endpoint := "/cloud/project/" + url.PathEscape(data.ServiceName.ValueString()) + "/region/" + url.PathEscape(data.RegionName.ValueString()) + "/volume" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when using POST on this route, won't it just recreate a new volume ?
Shouldn't you use PUT /cloud/project/{serviceName}/volume/{volumeId}
instead ?
} | ||
|
||
// Read updated resource | ||
endpoint = "/cloud/project/" + url.PathEscape(data.ServiceName.ValueString()) + "/region/" + url.PathEscape(data.RegionName.ValueString()) + "/volume/" + url.PathEscape(data.VolumeId.ValueString()) + "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint = "/cloud/project/" + url.PathEscape(data.ServiceName.ValueString()) + "/region/" + url.PathEscape(data.RegionName.ValueString()) + "/volume/" + url.PathEscape(data.VolumeId.ValueString()) + "" | |
endpoint = "/cloud/project/" + url.PathEscape(data.ServiceName.ValueString()) + "/region/" + url.PathEscape(data.RegionName.ValueString()) + "/volume/" + url.PathEscape(data.VolumeId.ValueString()) |
} | ||
|
||
// Delete API call logic | ||
endpoint := "/cloud/project/" + url.PathEscape(data.ServiceName.ValueString()) + "/volume/" + url.PathEscape(data.VolumeId.ValueString()) + "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint := "/cloud/project/" + url.PathEscape(data.ServiceName.ValueString()) + "/volume/" + url.PathEscape(data.VolumeId.ValueString()) + "" | |
endpoint := "/cloud/project/" + url.PathEscape(data.ServiceName.ValueString()) + "/volume/" + url.PathEscape(data.VolumeId.ValueString()) |
), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
resource.TestCheckResourceAttr("ovh_cloud_project_volume.volume", "region_name", os.Getenv("OVH_CLOUD_PROJECT_REGION_TEST")), | ||
resource.TestCheckResourceAttr("ovh_cloud_project_volume.volume", "service_name", os.Getenv("OVH_CLOUD_PROJECT_SERVICE_TEST")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resource.TestCheckResourceAttr("ovh_cloud_project_volume.volume", "service_name", os.Getenv("OVH_CLOUD_PROJECT_SERVICE_TEST")), | |
resource.TestCheckResourceAttr("ovh_cloud_project_volume.volume", "service_name", serviceName), |
|
||
The following arguments are supported: | ||
|
||
* `service_name` - The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used. **Changing this value recreates the resource.** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `service_name` - The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used. **Changing this value recreates the resource.** | |
* `service_name` - Required. The id of the public cloud project. **Changing this value recreates the resource.** |
doesn't seem true
The following arguments are supported: | ||
|
||
* `service_name` - The id of the public cloud project. If omitted, the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used. **Changing this value recreates the resource.** | ||
* `region_name` - A valid OVHcloud public cloud region name in which the volume will be available. Ex.: "GRA11". **Changing this value recreates the resource.** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `region_name` - A valid OVHcloud public cloud region name in which the volume will be available. Ex.: "GRA11". **Changing this value recreates the resource.** | |
* `region_name` - Required. A valid OVHcloud public cloud region name in which the volume will be available. Ex.: "GRA11". **Changing this value recreates the resource.** |
"region_name": schema.StringAttribute{ | ||
CustomType: ovhtypes.TfStringType{}, | ||
Required: true, | ||
Description: "Region name", | ||
MarkdownDescription: "Region name", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"region_name": schema.StringAttribute{ | |
CustomType: ovhtypes.TfStringType{}, | |
Required: true, | |
Description: "Region name", | |
MarkdownDescription: "Region name", | |
}, | |
"region_name": schema.StringAttribute{ | |
CustomType: ovhtypes.TfStringType{}, | |
Required: true, | |
Description: "Region name", | |
MarkdownDescription: "Region name", | |
PlanModifiers: []planmodifier.String{ | |
stringplanmodifier.RequiresReplace(), | |
}, | |
}, |
and same for other fields that should trigger a replace (at least service_name
, size
and type
) if the doc is correct
* `size` - Size of the volume **Changing this value recreates the resource.** | ||
* `id` - id of the volume **Changing this value recreates the resource.** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `size` - Size of the volume **Changing this value recreates the resource.** | |
* `id` - id of the volume **Changing this value recreates the resource.** | |
* `size` - Size of the volume | |
* `id` - id of the volume |
Description
Resource volume
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Test Configuration:
terraform version
: Terraform vx.y.zChecklist: